#ifndef _UTIL_H_
#define _UTIL_H_

#include <tuple>

namespace Engine2D
{
    template<typename Tp, typename F, typename size_t idx = 0>
    inline void TupleForeach(Tp & tp, F && fn) 
    {
        if constexpr (idx < std::tuple_size_v<Tp>) {
            fn(std::get<idx>(tp));
            TupleForeach<Tp, F, idx + 1>(tp, std::forward<F>(fn));
        }
    }

    inline bool IsAllTrue(bool t) {
        return t;
    }
    template<typename T1, typename... T2>
    inline bool IsAllTrue(T1 t1, T2... t2) 
    {
        if (t1 == false) {
            return false;
        }
        if constexpr (sizeof...(T2) > 0) {
            return IsAllTrue(t2...);
        }
    }


} // namespace Engine2D
 

#endif